//package com.example.springbatch_test_api;
//
//import com.sun.org.apache.regexp.internal.RE;
//import org.springframework.batch.core.*;
//import org.springframework.batch.core.explore.JobExplorer;
//import org.springframework.batch.core.launch.JobLauncher;
//import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
//import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
//import org.springframework.batch.core.repository.JobRestartException;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//
//@RestController
//public class BatchController {
//
//    @Resource
//    private Job job;
//
//    @Resource
//    private JobLauncher jobLauncher;
//
//    // job对象的-展示对象
//    @Resource
//    private JobExplorer jobExplorer;
//
//    @PostMapping("/test/api")
//    public Object testApi() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
//
//        JobParameters jobParameters = new JobParametersBuilder(jobExplorer)
//                .addString("name", "xiang")
//                .getNextJobParameters(job)
//                .toJobParameters();
//
//
//        JobExecution jobExecution = jobLauncher.run(job, jobParameters);
//
//        return jobExecution.getExitStatus();
//
//
//    }
//}
